
#include "includes.h"
#include "structs.h"
#include "declares.h"

struct grape_graph_t grape_graph;

struct grape_var_t grape_var;

/* input of graph comes here */ 
struct grape_file_t grape_file;

/* loggers for diff purposes */
zlog_category_t *grape_inter_logger, *grape_proc_logger;

struct grape_data_t grape_data;

struct grape_app_t grape_app;

struct grape_plugin_t *grape_plugin;


FILE *grape_get_output_file()
{
        return grape_file.dat;
}

int grape_get_vn()
{
        return grape_data.vn;
}

int grape_get_en()
{
        return grape_data.en;
}

void *grape_get_query(struct args_t *args)
{
        return args->query;
}

void grape_set_app_name(char *name)
{
        if(name) {
                grape_app.app_name=getbasename(name);
        }
        else {
                grape_app.app_name="grape";
        }
}

struct Fragment *grape_get_fragment(struct args_t *args)
{
        return args->fragment;
}

void *grape_get_partial_result(struct args_t *args)
{
        return args->result;
}

struct msg_buf_t *grape_get_messages_buffer(struct args_t *args)
{
        return args->messages;
}

int grape_get_fid(struct args_t * args)
{
        return args->fragment->fid;
}

int fragment_get_innerv_size(struct Fragment *fragment)
{
        return fragment->innerv_size;
}

struct vertex_t *fragment_get_innerv_at(struct Fragment *fragment, int vid)
{
        return igraph_vector_ptr_e(fragment->innerv, vid);
}

int vertex_get_comm_size(struct vertex_t *pv)
{
        return igraph_vector_int_size(pv->fids);
}

int vertex_get_comm_at(struct vertex_t *pv, int index)
{
        return igraph_vector_int_e(pv->fids, index);
}
